package com.itbaizhan.shopping_manager_api.security;

import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//统一异常处理器
@RestControllerAdvice
public class AccessDeniedExceptionHandler {
    //处理权限异常时，捕获到异常在抛出，交给MyAccessDeniedHandler来处理
    @ExceptionHandler(AccessDeniedException.class)
    public String accessDeniedExceptionHandler(AccessDeniedException e) throws AccessDeniedException
    {
        throw e;
    }
}
